package com.rider.model;



import java.sql.Timestamp;
import java.util.List;
import com.member.model.*;

public class CarRiderService {

	private CarRiderPathVO_interface dao;

	public CarRiderService() {
		dao = new CarRiderPathDAO();
	}

	public CarRiderPathVO addCarRiderPath(String member_id,Integer distance,Integer share_fee,String start_point,
			Timestamp departure_date,String end_point, Timestamp arrival_date,Integer status,Integer company,String pool_type) {


		CarRiderPathVO carriderVO1= new CarRiderPathVO();
		carriderVO1.setMember_id(member_id);
		carriderVO1.setDistance(distance);
		carriderVO1.setShare_fee(share_fee);
		carriderVO1.setStart_point(start_point);
		carriderVO1.setDeparture_date(departure_date);
		carriderVO1.setEnd_point(end_point);
		carriderVO1.setArrival_date(arrival_date);
		carriderVO1.setStatus(status);
		carriderVO1.setCompany(company);
		carriderVO1.setPool_type(pool_type);
	
		dao.insert(carriderVO1);

		return carriderVO1;
	}

	public CarRiderPathVO updateCarRiderPath( Integer Distance, 
			Integer Share_fee,String start_point,Timestamp departure_date,String end_point,Timestamp arrival_date,
			Integer Status,String pool_type,String rider_path_id,String member_id,Integer company,String regular_id) {

		CarRiderPathVO carriderVO2= new CarRiderPathVO();
		carriderVO2.setDistance(Distance);
		carriderVO2.setShare_fee(Share_fee);
		carriderVO2.setStart_point(start_point);
		carriderVO2.setDeparture_date(departure_date);
		carriderVO2.setEnd_point(end_point);
		carriderVO2.setArrival_date(arrival_date);
		carriderVO2.setStatus(Status);
		carriderVO2.setPool_type(pool_type);
		carriderVO2.setRider_path_id(rider_path_id);
		carriderVO2.setMember_id(member_id);
		carriderVO2.setCompany(company);
		carriderVO2.setRegular_id(regular_id);
		dao.update(carriderVO2);

		return carriderVO2;
	}

	public void deleteCarRider(String Rider_path_id) {
		dao.delete(Rider_path_id);
	}

	public CarRiderPathVO getOneCarRider(String Rider_path_id) {
		return dao.findByPrimaryKey(Rider_path_id);
	}
	
	public List<CarRiderPathVO> getAllByMemberId(String memberId) {
		return dao.getAll(memberId);
	}

	public List<CarRiderPathVO> getAll() {
		return dao.getAll();
	}
	
	public MemberVO getMemberByRiderPathId(String riderPathId) {
		return dao.getMemberByRiderPathId(riderPathId);
	}
}
